package com.example.springboot.mapper;

import com.example.springboot.entity.Approval;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ApprovalMapper {
    @Select("SELECT * from sys_approval")
    List<Approval> findAll();

    @Insert("insert into sys_approval(approver_id,is_agree,note) " +
            "VALUES (#{approverId},#{isAgree},#{note});")
    int insert(Approval approval);

    int update(Approval approval);

    @Select("SELECT max(id) from sys_approval;")
        //查询最新增加的审批单的id
    Integer findLatest();

    @Select("SELECT * from sys_approval where id = #{id}")
    Approval findById(Integer id);
}
